package cn.sxt.common.userscenter.util;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

import org.springframework.stereotype.Component;
/**
 * 文件工具类
 * @author Administrator
 *
 */
@Component("fileUtil")
public class FileUtil {
	/**
	 * 读取输入流对应的文件
	 * @param is
	 * @return
	 */
	public String readFile(InputStream is){
		StringBuffer sb = new StringBuffer();
		BufferedReader br = null;
		try {
			br = new BufferedReader(new InputStreamReader(is,"UTF-8"));
			String line = "";
			while((line = br.readLine()) != null){
				sb.append(line);
			}
		} catch (Exception e) {
			ConstantFinalUtil.LOGGER.error("------读取文件出错-----");
		}
		return sb.toString();
	}
}
